<?php
declare (strict_types=1);

namespace app\exam\service;

use app\common\logic\category\admin\Category as CategoryLogic;
use think\facade\Request;
use app\common\service\BaseService;
use app\exam\logic\Module as ModuleLogic;

/**
 * 版块接口类
 *
 * @package app\exam\service
 */
class Module extends BaseService
{

	public function getModuleList()
	{
		$data = app(ModuleLogic::class)->getModuleList();
		$module = app(ModuleLogic::class)->getModuleList();
        $data = app(CategoryLogic::class)->getList()->toArray();
        foreach ($data as &$item){
            $item['cover_url']='';
            $item['module_type']='';
            foreach ($module as $value){
                if ($value->title==$item['title']){
                    $item['cover_url']=$value->cover_url;
                    $item['module_type']=$value->module_type;
                }
            }
        }
		return $this->parseToData($data, 1, '获取成功');
	}
}
